#include "apue.h"
#include <stdio.h>
#include <time.h>

/**
 * example:
 *  ./a.out
 *  TZ= ./a.out
 *  TZ=CST ./a.out
 */
int main(void) {
    time_t t;
    struct tm *tm;
    char st[64];

    time(&t);
    if ((tm= localtime(&t)) == NULL)
        err_sys("localtime error");

    if (strftime(st, 64, "%a %b %d %X %Z %Y", tm) == 0)
        err_sys("strftime error");
    
    printf("current time is %s\n", st);
}

